Release 10.1A: OpenEdge Development:
Programming Interfaces
Accessing the control handle
Once the ActiveX control is instantiated, the control-frame affords access to one widget and three COM objects, including the:
Figure 16–4 shows the chain of handle references that connect a control-frame widget (with widget handle CF) to an ActiveX control (with the Name
CSSpin).Figure 16–4: Handle references to access ActiveX controls
![]()
The
chCFreference is a component handle to the control-frame COM object (control container) and thechCOLreference is a component handle to the control collection. Thus in the 4GL, you can instantiate and get the handle to an ActiveX control in two ways:Once you have the component handle of the ActiveX control, you can access all of its properties and methods. (The
chCSSpinreference is a component handle variable you might set fromchCF:CSSpinorchCOL:Item(1).) The following examples reference a reduction of typical code generated by the AppBuilder. For a closer look at actual code generated by the AppBuilder, see the "Programming ActiveX controls in the AppBuilder" section.Using the Control-Name property of the control container
This example show how you might access the component handle to the
CSSpincontrol using the Control-Name property:
The bolded code is the code you might add to appropriate sections of your application; the rest is a simplified version of code the AppBuilder might generate. Note how the AppBuilder uses the control-frame name (
CtrlFrame) to generate handle variable names and to locate the control instance in thecsspinapp.wrxfile. The actual control name (CSSpin) is the OCX name specified for the control at design time (in this case, theCSSpindefault).Using the item property of the control collection
This similar example uses the control collection to return the control’s component handle:
The handle connections
The previous examples rely on attributes, properties, and methods supported by Progress to get a component handle from a control-frame widget handle (see Figure 16–4). Thus, to provide access to the control-frame widget and its related COM objects:
- The control-frame widget has a
COM-HANDLEattribute that returns the component handle of the control-frame COM object.Note: The control collection is a standard COM object that is used to access sets of like objects (objects in the same class).- The control-frame COM object has a Controls property that returns the component handle of the control collection. You can then use the Item property on the collection component handle to get the component handle of the control.
- The control-frame COM object has a special property named after the ActiveX control that returns the component handle of the control.
- The control-frame COM object provides a Widget-Handle property that returns the widget handle of the instantiating control-frame widget.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |